﻿using System;

namespace Klinkby
{
    [Serializable]
    public class Tuple<T0> : IEquatable<Tuple<T0>>
    {
        readonly T0 _item0;
        internal Tuple(T0 item0)
        {
            _item0 = item0;
        }
        public T0 Item0
        {
            get { return _item0; }
        }
        public bool Equals(Tuple<T0> other)
        {
            if (object.ReferenceEquals(other, null))
                return false;
            return !object.ReferenceEquals(_item0, null)
               ? _item0.Equals(other._item0)
               : object.ReferenceEquals(other._item0, null);
        }
        public override bool Equals(object obj)
        {
            var t = obj as Tuple<T0>;
            return this == t;
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
        public override string ToString()
        {
            return string.Format("({0})", _item0);
        }
    }
}
